package com.brk.socket.server;

import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author brk
 * @date 2023/7/14 14:38
 * @description
 */
@ChannelHandler.Sharable
public class CustomChannelInitializer extends ChannelInitializer<SocketChannel> {

    @Autowired
    private CustomServerHandler serverHandler;

    @Override
    protected void initChannel(SocketChannel ch) {
        ChannelPipeline pipeline = ch.pipeline();
        pipeline.addLast(serverHandler);
    }

}
